package org.cdivtc.exam.controller;


import io.swagger.annotations.*;

import org.cdivtc.exam.service.AdminsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

/**
 * <p>
 * 系统管理员信息表 前端控制器
 * </p>
 *
 * @author xiaogoudashuai
 * @since 2025-03-27
 */
@Api(tags = "管理员操作")
@RestController
public class AdminsController {

    @Autowired
    private AdminsService adminsService;


    @ApiOperation(value = "登录",
            notes = "<span style = 'color:red'>模拟操作，密码为明文密码</span>",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "account",type = "String",required = true),
            @ApiImplicitParam(name = "password",type = "String",required = true)
    })

    @PostMapping("admin/login")
    @ApiParam
    public Map<String, Object> login(@RequestParam String account,
                                     @RequestParam String password) {
        return adminsService.login(account, password);
    }


    @GetMapping("admin/update")
    @ApiOperation(value = "管理员信息修改")
    @ApiParam
    @ApiImplicitParams({
            @ApiImplicitParam(name = "current",value = "当前页数",
                    defaultValue = "1",dataType = "Integer",paramType = "query"),
            @ApiImplicitParam(name = "size",value = "页面行数",
                    dataType = "Integer",paramType = "query",defaultValue = "10"),
            @ApiImplicitParam(name = "condition",value = "",defaultValue = "String",paramType = "query"),
            @ApiImplicitParam(name = "user_type",value = "",dataType = "Integer",required = true)
    })
    public String sayHello() {


//        User user = adminsService.save(use);
        return "Hello, World!";

    }
}


